package tasknow.storage;

import java.util.Calendar;

import tasknow.utils.Constants;

public class Constraints {

	// @author A0118386X

	private static final int MAX_YEAR = Calendar.getInstance().get(Calendar.YEAR)+5;
	private static final int MIN_YEAR = Constants.DEFAULT_YEAR;
	private static final int MAX_MONTH = 12;
	private static final int MIN_MONTH = 0;
	private static final int MAX_DATE = 31;
	private static final int MIN_DATE = 0;
	private static final int MIN_MINUTE = 0;
	private static final int MAX_MINUTE = 59;
	private static final int MAX_HOUR = 23;
	private static final int MIN_HOUR = 0;

	public static boolean isValidCalendar(int year, int month, int day, int hour, int minute) {
		if (isValidYear(year) && isValidMonth(month) && isValidDay(day) && isValidHour(hour) && isValidMinute(minute)) {
			return true;
		} else {
			return false;
		}
	}

	private static boolean isValidYear(int year_) {
		if (year_ >= MIN_YEAR && year_ <= MAX_YEAR) {
			return true;
		} else {
			return false;
		}
	}

	private static boolean isValidMonth(int month_) {
		if (month_ >= MIN_MONTH && month_ <= MAX_MONTH) {
			return true;
		} else {
			return false;
		}
	}

	private static boolean isValidDay(int day_) {
		if (day_ >= MIN_DATE && day_ <= MAX_DATE) {
			return true;
		} else {
			return false;
		}
	}

	private static boolean isValidHour(int hour_) {
		if (hour_ >= MIN_HOUR && hour_ <= MAX_HOUR) {
			return true;
		} else {
			return false;
		}
	}

	private static boolean isValidMinute(int minute_) {
		if (minute_ >= MIN_MINUTE && minute_ <= MAX_MINUTE) {
			return true;
		} else {
			return false;
		}
	}

}
